﻿using System.Collections.ObjectModel;
using System.Configuration;

namespace MiniFox.Mail.Configurations
{
    /// <summary>
    /// 
    /// </summary>
    public class CopySendSettingCollection : KeyedCollection<string, CopySendSetting>
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        protected override string GetKeyForItem(CopySendSetting item)
        {
            return item.Account;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="copySendSettings"></param>
        /// <returns></returns>
        public static implicit operator string[] (CopySendSettingCollection copySendSettings)
        {
            if (copySendSettings == null)
                return null;
            string[] settings = new string[copySendSettings.Count];
            for (int i = 0; i < settings.Length; i++)
            {
                settings[i] = copySendSettings[i].Account;
            }
            return settings;
        }
    }
}
